home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1774 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.4 KB  |  65 lines

  1. Path: news.express.co.nz!usenet
  2. From: bruce@faxmail.co.nz (Bruce Simpson)
  3. Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc,comp.os.ms-windows.programmer.tools.misc,alt.folklore.computers
  4. Subject: Re: C++ with Zapp vs. Delphi
  5. Date: Fri, 12 Jan 1996 22:09:07 GMT
  6. Organization: FaxMail Technologies
  7. Message-ID: <4d6ir9$m70@news.express.co.nz>
  8. References: <4cfor8$qno@picasso.op.net> <lKI7w0JfF61N089yn@oslonett.no> <4coar6$d4n@sun4.bham.ac.uk> <4cpek3$i7@brasaap.iaehv.nl> <4cv6bn$eiu@uuneo.neosoft.com> <rq+8w0JfFC7A089yn@oslonett.no>
  9. Reply-To: bruce@faxmail.co.nz
  10. NNTP-Posting-Host: bsimpson.iprolink.co.nz
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. mobergru@oslonett.no (Rune Moberg) wrote:
  14.  
  15. >Two years ago, I made a small menu program (AMI bios style), using BP 7.0.
  16. >I had objects, some polymorphism, the works...
  17. >The first draft (without any text, only the basic UI) compiled to 7K. That's
  18. >far less than the stuff the BC++ 3.1 compiler threw at me (20K for small
  19. >"hello world" style C apps).
  20.  
  21. This is very often a case of style and compiler choice.  There's frequently
  22. a world of difference in the size of these two "hello world" programs:
  23.  
  24.  
  25. --- program 1 ----------------------------------------
  26.  
  27. #include <stdio.h>
  28.  
  29. int main(int argc, char *argv[])
  30. {
  31.     printf("Hello World\n");
  32. }
  33.  
  34.  
  35. --- program 2 -----------------------------------------
  36.  
  37. #include <stdio.h>
  38.  
  39. int mail(int argc, char *argv[])
  40. {
  41.     puts("Hello World\n");
  42. }
  43.  
  44.  
  45. Program 1 will link the library routines for handling printf() and this can
  46. be a lot of code, whereas program 2 will link the smaller and more
  47. efficient puts() function.
  48.  
  49. Many times, programmers don't even think about this and to be fair, most of
  50. the time it doesn't matter very much.  These days a lot of PCs are being
  51. shipped with 850MB or 1GB HDs which are formatted as a single partition
  52. with a resulting cluster size of 16Kbytes.  A 2Kbyte program is actually
  53. going to require just as much storage as a 15.9K program.  Likewise, the
  54. size of the .EXE file is not always a true indicator of the amount of RAM
  55. that the program uses when running.
  56.  
  57. The difference between Pascal and C or C++ disappears fairly quickly when
  58. you start looking at "real-world" applications of any size.
  59.  
  60. ---------------------------------------------------------------
  61. Check out the "ShowCase" on FaxMail for Web-space from NZ$5/mth
  62. FaxMail: http://www.actrix.gen.nz/biz/faxmail
  63. My page: http://www.voyager.co.nz/~bsimpson
  64.  
  65.